.class final Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;
.super Lkotlin/jvm/internal/Lambda;
.source "GPSUSBSettingsView.kt"

# interfaces
.implements Lkotlin/jvm/functions/Function1;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView;->initialize(Landroid/content/Context;)V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x18
    name = null
.end annotation

.annotation system Ldalvik/annotation/Signature;
    value = {
        "Lkotlin/jvm/internal/Lambda;",
        "Lkotlin/jvm/functions/Function1<",
        "Landroid/view/View;",
        "Lkotlin/Unit;",
        ">;"
    }
.end annotation


# instance fields
.field final synthetic $baudRates:Landroid/widget/Spinner;

.field final synthetic $baudRatesAdapter:Landroid/widget/ArrayAdapter;

.field final synthetic $context:Landroid/content/Context;

.field final synthetic $dataBits:Landroid/widget/Spinner;

.field final synthetic $dataBitsAdapter:Landroid/widget/ArrayAdapter;

.field final synthetic $flowControl:Landroid/widget/Spinner;

.field final synthetic $flowControlAdapter:Landroid/widget/ArrayAdapter;

.field final synthetic $parity:Landroid/widget/Spinner;

.field final synthetic $parityAdapter:Landroid/widget/ArrayAdapter;

.field final synthetic $stopBits:Landroid/widget/Spinner;

.field final synthetic $stopBitsAdapter:Landroid/widget/ArrayAdapter;


# direct methods
.method constructor <init>(Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/widget/ArrayAdapter;Landroid/widget/Spinner;Landroid/content/Context;)V
    .locals 0

    iput-object p1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$baudRatesAdapter:Landroid/widget/ArrayAdapter;

    iput-object p2, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$baudRates:Landroid/widget/Spinner;

    iput-object p3, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$dataBitsAdapter:Landroid/widget/ArrayAdapter;

    iput-object p4, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$dataBits:Landroid/widget/Spinner;

    iput-object p5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$stopBitsAdapter:Landroid/widget/ArrayAdapter;

    iput-object p6, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$stopBits:Landroid/widget/Spinner;

    iput-object p7, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$parityAdapter:Landroid/widget/ArrayAdapter;

    iput-object p8, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$parity:Landroid/widget/Spinner;

    iput-object p9, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$flowControlAdapter:Landroid/widget/ArrayAdapter;

    iput-object p10, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$flowControl:Landroid/widget/Spinner;

    iput-object p11, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    const/4 p1, 0x1

    invoke-direct {p0, p1}, Lkotlin/jvm/internal/Lambda;-><init>(I)V

    return-void
.end method


# virtual methods
.method public bridge synthetic invoke(Ljava/lang/Object;)Ljava/lang/Object;
    .locals 0

    .line 21
    check-cast p1, Landroid/view/View;

    invoke-virtual {p0, p1}, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->invoke(Landroid/view/View;)V

    sget-object p1, Lkotlin/Unit;->INSTANCE:Lkotlin/Unit;

    return-object p1
.end method

.method public final invoke(Landroid/view/View;)V
    .locals 13

    const-string v0, "it"

    invoke-static {p1, v0}, Lkotlin/jvm/internal/Intrinsics;->checkParameterIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    .line 78
    iget-object p1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$baudRatesAdapter:Landroid/widget/ArrayAdapter;

    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$baudRates:Landroid/widget/Spinner;

    const-string v1, "baudRates"

    invoke-static {v0, v1}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v0}, Landroid/widget/Spinner;->getSelectedItemPosition()I

    move-result v0

    invoke-virtual {p1, v0}, Landroid/widget/ArrayAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object p1

    check-cast p1, Llt/farmis/libraries/externalgps/utils/NamedInt;

    .line 79
    iget-object v0, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$dataBitsAdapter:Landroid/widget/ArrayAdapter;

    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$dataBits:Landroid/widget/Spinner;

    const-string v2, "dataBits"

    invoke-static {v1, v2}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v1}, Landroid/widget/Spinner;->getSelectedItemPosition()I

    move-result v1

    invoke-virtual {v0, v1}, Landroid/widget/ArrayAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Llt/farmis/libraries/externalgps/utils/NamedInt;

    .line 80
    iget-object v1, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$stopBitsAdapter:Landroid/widget/ArrayAdapter;

    iget-object v2, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$stopBits:Landroid/widget/Spinner;

    const-string v3, "stopBits"

    invoke-static {v2, v3}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v2}, Landroid/widget/Spinner;->getSelectedItemPosition()I

    move-result v2

    invoke-virtual {v1, v2}, Landroid/widget/ArrayAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Llt/farmis/libraries/externalgps/utils/NamedInt;

    .line 81
    iget-object v2, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$parityAdapter:Landroid/widget/ArrayAdapter;

    iget-object v3, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$parity:Landroid/widget/Spinner;

    const-string v4, "parity"

    invoke-static {v3, v4}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v3}, Landroid/widget/Spinner;->getSelectedItemPosition()I

    move-result v3

    invoke-virtual {v2, v3}, Landroid/widget/ArrayAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v2

    check-cast v2, Llt/farmis/libraries/externalgps/utils/NamedInt;

    .line 82
    iget-object v3, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$flowControlAdapter:Landroid/widget/ArrayAdapter;

    iget-object v4, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$flowControl:Landroid/widget/Spinner;

    const-string v5, "flowControl"

    invoke-static {v4, v5}, Lkotlin/jvm/internal/Intrinsics;->checkExpressionValueIsNotNull(Ljava/lang/Object;Ljava/lang/String;)V

    invoke-virtual {v4}, Landroid/widget/Spinner;->getSelectedItemPosition()I

    move-result v4

    invoke-virtual {v3, v4}, Landroid/widget/ArrayAdapter;->getItem(I)Ljava/lang/Object;

    move-result-object v3

    check-cast v3, Llt/farmis/libraries/externalgps/utils/NamedInt;

    .line 84
    sget-object v4, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_BAUD_RATE:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    invoke-virtual {p1}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v6

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-virtual {v4, v5, v6}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    .line 85
    sget-object v4, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_DATA_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v6

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-virtual {v4, v5, v6}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    .line 86
    sget-object v4, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_STOP_BITS:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    invoke-virtual {v1}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v6

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-virtual {v4, v5, v6}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    .line 87
    sget-object v4, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_PARITY:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    invoke-virtual {v2}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v6

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-virtual {v4, v5, v6}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    .line 88
    sget-object v4, Llt/noframe/gpsfarmguide/utils/Preferences;->GPS_USB_FLOW_CONTROL:Llt/minvib/magicpreferences/MagicIntegerPreference;

    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    invoke-virtual {v3}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v6

    invoke-static {v6}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v6

    invoke-virtual {v4, v5, v6}, Llt/minvib/magicpreferences/MagicIntegerPreference;->set(Landroid/content/Context;Ljava/lang/Integer;)V

    .line 90
    sget-object v4, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v4

    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/ExternalGPS;->getGpsThread()Llt/farmis/libraries/externalgps/ExternalGPSThread;

    move-result-object v4

    .line 91
    sget-object v5, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v5}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v5

    invoke-virtual {v5}, Llt/farmis/libraries/externalgps/ExternalGPS;->getExternalGPSState()Llt/farmis/libraries/externalgps/providers/Status;

    move-result-object v5

    sget-object v6, Llt/farmis/libraries/externalgps/providers/Status;->CONNECTED:Llt/farmis/libraries/externalgps/providers/Status;

    if-ne v5, v6, :cond_2

    if-eqz v4, :cond_2

    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/ExternalGPSThread;->getMDeviceProvider()Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;

    move-result-object v5

    instance-of v5, v5, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    if-eqz v5, :cond_2

    .line 92
    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/ExternalGPSThread;->getMDeviceProvider()Llt/farmis/libraries/externalgps/providers/NMEADeviceManager;

    move-result-object v4

    if-eqz v4, :cond_1

    check-cast v4, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;

    invoke-virtual {v4}, Llt/farmis/libraries/externalgps/providers/usb/NmeaUSBDevice;->getDevice()Landroid/hardware/usb/UsbDevice;

    move-result-object v4

    .line 94
    iget-object v5, p0, Llt/noframe/gpsfarmguide/widgets/gps/GPSUSBSettingsView$initialize$2;->$context:Landroid/content/Context;

    const-string v6, "usb"

    invoke-virtual {v5, v6}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v5

    if-eqz v5, :cond_0

    check-cast v5, Landroid/hardware/usb/UsbManager;

    .line 95
    sget-object v6, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v6}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v6

    invoke-virtual {v6}, Llt/farmis/libraries/externalgps/ExternalGPS;->disconnect()V

    .line 96
    sget-object v7, Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;->Companion:Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs$Companion;

    invoke-virtual {p1}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v8

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v9

    invoke-virtual {v1}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v10

    invoke-virtual {v2}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v11

    invoke-virtual {v3}, Llt/farmis/libraries/externalgps/utils/NamedInt;->getValue()I

    move-result v12

    invoke-virtual/range {v7 .. v12}, Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs$Companion;->createCustom(IIIII)Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;

    move-result-object p1

    .line 98
    sget-object v0, Llt/farmis/libraries/externalgps/ExternalGPS;->Companion:Llt/farmis/libraries/externalgps/ExternalGPS$Companion;

    invoke-virtual {v0}, Llt/farmis/libraries/externalgps/ExternalGPS$Companion;->getInstance()Llt/farmis/libraries/externalgps/ExternalGPS;

    move-result-object v0

    new-instance v1, Llt/farmis/libraries/externalgps/nmea/NmeaParser;

    invoke-direct {v1}, Llt/farmis/libraries/externalgps/nmea/NmeaParser;-><init>()V

    invoke-virtual {v0, v4, v5, p1, v1}, Llt/farmis/libraries/externalgps/ExternalGPS;->startUSBExternalGPS(Landroid/hardware/usb/UsbDevice;Landroid/hardware/usb/UsbManager;Llt/farmis/libraries/externalgps/providers/usb/USBDeviceManagerConfigs;Llt/farmis/libraries/externalgps/nmea/NmeaParser;)V

    goto :goto_0

    .line 94
    :cond_0
    new-instance p1, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type android.hardware.usb.UsbManager"

    invoke-direct {p1, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p1

    .line 92
    :cond_1
    new-instance p1, Lkotlin/TypeCastException;

    const-string v0, "null cannot be cast to non-null type lt.farmis.libraries.externalgps.providers.usb.NmeaUSBDevice"

    invoke-direct {p1, v0}, Lkotlin/TypeCastException;-><init>(Ljava/lang/String;)V

    throw p1

    :cond_2
    :goto_0
    return-void
.end method
